package com.tianjishuju.cimiss.station.station.util;

import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Properties;

import org.apache.log4j.Logger;

public class ReadProperties {

	private static Logger log = Logger.getLogger(ReadProperties.class);
	private static Properties pros = null;

	private synchronized static void loadInitFile(String propPath) throws Exception {
		if (pros == null) {
			pros = new Properties();
		}
		try {
			InputStream inStream = new FileInputStream(propPath);
			pros.load(inStream);
		} catch (Exception e) {
			e.printStackTrace();
			throw new Exception("读取jsonFile异常！:filePath = " + propPath + ",ex = " + e);
		}
	}

	public static String getProperty(String propPath, String propName) throws Exception {
		loadInitFile(propPath);
		return pros.getProperty(propName);
	}

}
